package com.softer.wxzj.mapper;

import com.softer.wxzj.entity.HouseAndOwner;
import com.softer.wxzj.entity.RefPayInfo;
import com.softer.wxzj.entity.RefReq;
import com.softer.wxzj.entity.RefReqList;
import com.softer.wxzj.mapper.base.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

@Repository
public interface RefReqListMapper extends BaseMapper<RefReqList> {
    RefReqList getPayAmountByReqIdToVoucher(String reqId);

    RefReqList getOwnerInfoByHouseIdAndPayNo(@Param("payNo") String payNo, @Param("houseId") String houseId);

    RefReqList getOwnerInfoByPayNo(String payNo);

    List<RefReqList> getListByReqIdNoKeep(String reqId);

    List<RefReqList> getListByPayNo(String payNo);

    /**
     * 修改支付编号,根据退款ID
     *
     * @param payNo
     * @param reqId
     * @return
     */
    int updatePayNoByReqId(@Param("payNo") String payNo, @Param("reqId") String reqId);

    /**
     * 修改支付编号，根据支付编号
     *
     * @param payNo
     * @param oldPayNo
     * @return
     */
    int updatePayNoByOldPayNo(@Param("payNo") String payNo, @Param("oldPayNo") String oldPayNo);

    /**
     * 批量退款查询明细
     *
     * @param refReq
     * @return
     */
    List<RefReqList> getBatchRefReqListDetail(RefReq refReq);

    /**
     * 批量退款查询明细
     *
     * @param refReq
     * @return
     */
    List<RefReqList> getBatchRefReqListDetailLog(RefReq refReq);

    /**
     * 通过req查询信息
     */
    RefReqList getInfoByreqId(String id);

    /**
     * 查询列表（审批详情页）
     *
     * @param id
     * @return
     */
    List<RefReqList> getAuditList(String id);

    /**
     * 退款信息
     */
    List<HouseAndOwner> selectOwnerByHouseId(HouseAndOwner houseAndOwner);

    List<HouseAndOwner> selectOwnerByHouseIdFuzzy(@Param("buildNo") String buildNo, @Param("fuzzy") String fuzzy);

    /**
     * 根据房屋id查询已记账金额汇总
     *
     * @param houseId
     * @return
     */
    BigDecimal getMoney(String houseId);

    /**
     * 根据申请编号查询列表
     *
     * @param reqId
     * @return
     */
    List<RefReqList> getListByReqId(String reqId);

    /**
     * 根据reqId查询房屋id集合
     *
     * @param reqId
     * @return
     */
    List<String> getHouseIdListByReqId(String reqId);

    /**
     * 查询有几条书记
     */
    int selectCountNum(String id);

    RefReqList selectByPayNo(String payNo);

    /**
     * 修改房屋（记账 退款）
     *
     * @param busiNo
     * @return
     */
    int updateHouseFunBul(String busiNo);

    /**
     * 查询list通过payNo
     *
     * @param payNo
     * @return
     */
    List<RefReqList> getInfoByNo(String payNo);

    /**
     * 查询该支付编号下的房屋的状态为初交的所有的记过账的金额-
     */
    String selectAllPayAmount(String houseId);

    List<RefReqList> refDel(String reqId);
}
